'use strict';
const Service = require('egg').Service;

class StartWorkService extends Service {
  async start() {
    const { ctx } = this;
    const res = await ctx.curl('https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=7f29cdd0-1ef5-4a0b-a075-380f4d1ef4d0', {
      method: 'POST',
      data: {
        msgtype: 'template_card',
        template_card: {
          card_type: 'text_notice',
          source: {
            icon_url: 'https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0',
            desc: 'jira',
          },
          main_title: {
            title: '今日的jira提醒',
            desc: '链接点开请使用右上角用默认浏览器打开功能',
          },
          emphasis_content: {
            title: '100',
            desc: '希望你今天能得100分',
          },
          // sub_title_text: '下载企业微信还能抢红包！',
          horizontal_content_list: [
            {
              keyname: '发送人',
              value: '小绿',
            },
            {
              keyname: '绿材用户端',
              value: '点击访问',
              type: 1,
              url: 'http://121.37.166.100:8082/home',
            },
            {
              keyname: '绿材审核端',
              value: '点击审核',
              type: 1,
              url: 'http://121.37.166.100:8084/home',
            },
          ],
          jump_list: [
            {
              type: 1,
              url: 'https://jira.pkpm.cn/secure/RapidBoard.jspa?rapidView=548&projectKey=GBONLINE&selectedIssue=GBONLINE-334&sprint=692',
              title: '本次迭代工作',
            },
            {
              type: 1,
              url: 'https://jira.pkpm.cn/secure/WBSGanttMain.jspa?filter=BOARD_148',
              title: '本次迭代甘特图',
            },

          ],
          card_action: {
            type: 1,
            url: 'https://jira.pkpm.cn/secure/Dashboard.jspa',

          },
        },
      },
      dataType: 'json',
      headers: {
        'Content-Type': 'application/json',
      },
    });
    return res.data;
  }
}

module.exports = StartWorkService;
